package org.rich.charlesmurphy.model;

import java.util.HashSet;
import java.util.Set;

public enum ResourceType {

	// ONE BIG TODO -- this needs to be externalized and configurable


	PAGE("htm"),
	FRAGMENT("htm"), // TODO this f's up everything
	CSS("css"),
	JS("js"),
	IMAGE("gif", "png", "jpg"),
	AJAX("ajax"),  		// TODO this is very caretalks convention specific...
	OTHER;

	private Set<String> extensions;
	ResourceType(String ... extensions) {
		this.extensions = new HashSet<String>();
		for (String e : extensions) {
			this.extensions.add(e);
		}
	}

	public boolean hasExtension(String extension) {
		return extensions.contains(extension);
	}

	public String display() {
		String s = name().toLowerCase();
		return s.substring(0, 1).toUpperCase() + s.substring(1);
	}
}
